package sampleuiplugin;

import gamefw.gameplugin.AbstractGameLogic;
import gamefw.uiplugin.IInputManager;
import gamefw.uiplugin.IOutputManager;
import gamefw.uiplugin.IUIAbstractFactory;
import gamefw.uiplugin.IUIResourceProperties;
import gamefw.uiplugin.IVisualResource;

public class SampleUIAbstractFactory implements IUIAbstractFactory {
	
	private IOutputManager outputManager;
	
	@Override
	public void initialize(AbstractGameLogic gameLogic) {
	}

	@Override
	public IUIResourceProperties createUIResourceProperties() {
		return new SampleUIResourceProperties();
	}

	@Override
	public IInputManager createInputManager() {
		return new SampleInputManager();
	}

	@Override
	public IOutputManager createOutputManager() {
		this.outputManager = new SampleOutputManager(); 
		return this.outputManager;
	}

	@Override
	public IVisualResource createVisualResource(String visualResourceName) {
		try {
			return new SampleVisualResource(visualResourceName, this.outputManager);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
